<template>
  <div>
    <div>
      <el-button size="mini" @click="() => triggerModify()">新增</el-button>
    </div>
    <el-table :data="dataList" size="mini" :loading="loading">
      
      <el-table-column label="id" prop="id">
        <template #default="scope">
          <div>
            {{ scope.row["id"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="anchor_id" prop="anchor_id">
        <template #default="scope">
          <div>
            {{ scope.row["anchor_id"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="anchor_code" prop="anchor_code">
        <template #default="scope">
          <div>
            {{ scope.row["anchor_code"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="shop_code" prop="shop_code">
        <template #default="scope">
          <div>
            {{ scope.row["shop_code"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="platform" prop="platform">
        <template #default="scope">
          <div>
            {{ scope.row["platform"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="star_time" prop="star_time">
        <template #default="scope">
          <div>
            {{ scope.row["star_time"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="end_time" prop="end_time">
        <template #default="scope">
          <div>
            {{ scope.row["end_time"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="fans_num" prop="fans_num">
        <template #default="scope">
          <div>
            {{ scope.row["fans_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="gmv" prop="gmv">
        <template #default="scope">
          <div>
            {{ scope.row["gmv"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="gpm" prop="gpm">
        <template #default="scope">
          <div>
            {{ scope.row["gpm"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="refund_money" prop="refund_money">
        <template #default="scope">
          <div>
            {{ scope.row["refund_money"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="watch_num" prop="watch_num">
        <template #default="scope">
          <div>
            {{ scope.row["watch_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="transaction_rate" prop="transaction_rate">
        <template #default="scope">
          <div>
            {{ scope.row["transaction_rate"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="user_value" prop="user_value">
        <template #default="scope">
          <div>
            {{ scope.row["user_value"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="exposure_num" prop="exposure_num">
        <template #default="scope">
          <div>
            {{ scope.row["exposure_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="free_watch_num" prop="free_watch_num">
        <template #default="scope">
          <div>
            {{ scope.row["free_watch_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="pay_watch_num" prop="pay_watch_num">
        <template #default="scope">
          <div>
            {{ scope.row["pay_watch_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="strike_num" prop="strike_num">
        <template #default="scope">
          <div>
            {{ scope.row["strike_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="avg_online" prop="avg_online">
        <template #default="scope">
          <div>
            {{ scope.row["avg_online"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="max_online" prop="max_online">
        <template #default="scope">
          <div>
            {{ scope.row["max_online"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="live_exposure_num" prop="live_exposure_num">
        <template #default="scope">
          <div>
            {{ scope.row["live_exposure_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="deal_num" prop="deal_num">
        <template #default="scope">
          <div>
            {{ scope.row["deal_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="goods_exposure_num" prop="goods_exposure_num">
        <template #default="scope">
          <div>
            {{ scope.row["goods_exposure_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="goods_click_num" prop="goods_click_num">
        <template #default="scope">
          <div>
            {{ scope.row["goods_click_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="interact_num" prop="interact_num">
        <template #default="scope">
          <div>
            {{ scope.row["interact_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="comment_num" prop="comment_num">
        <template #default="scope">
          <div>
            {{ scope.row["comment_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="likes_num" prop="likes_num">
        <template #default="scope">
          <div>
            {{ scope.row["likes_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="share_num" prop="share_num">
        <template #default="scope">
          <div>
            {{ scope.row["share_num"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="new_fans" prop="new_fans">
        <template #default="scope">
          <div>
            {{ scope.row["new_fans"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="fans_pay_ratio" prop="fans_pay_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["fans_pay_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="purchase_fans" prop="purchase_fans">
        <template #default="scope">
          <div>
            {{ scope.row["purchase_fans"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="purchase_nonfans" prop="purchase_nonfans">
        <template #default="scope">
          <div>
            {{ scope.row["purchase_nonfans"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="nonpurchase_fans" prop="nonpurchase_fans">
        <template #default="scope">
          <div>
            {{ scope.row["nonpurchase_fans"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="nonpurchase_nonfans" prop="nonpurchase_nonfans">
        <template #default="scope">
          <div>
            {{ scope.row["nonpurchase_nonfans"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="interact_ratio" prop="interact_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["interact_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="attention_ratio" prop="attention_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["attention_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="live_folw_ratio" prop="live_folw_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["live_folw_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="attention_flow_ratio" prop="attention_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["attention_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="video_flow_ratio" prop="video_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["video_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="shop_flow_ratio" prop="shop_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["shop_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="other_flow_ratio" prop="other_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["other_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="shopwindow_flow_ratio" prop="shopwindow_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["shopwindow_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="freeflow_flow_ratio" prop="freeflow_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["freeflow_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="riverflow_pc_flow_ratio" prop="riverflow_pc_flow_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["riverflow_pc_flow_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="new_buy_bunch" prop="new_buy_bunch">
        <template #default="scope">
          <div>
            {{ scope.row["new_buy_bunch"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="product_click_pay_ucnt_ratio" prop="product_click_pay_ucnt_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["product_click_pay_ucnt_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="avg_watch_duration" prop="avg_watch_duration">
        <template #default="scope">
          <div>
            {{ scope.row["avg_watch_duration"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="watch_cnt_show_ratio" prop="watch_cnt_show_ratio">
        <template #default="scope">
          <div>
            {{ scope.row["watch_cnt_show_ratio"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="pay_cnt" prop="pay_cnt">
        <template #default="scope">
          <div>
            {{ scope.row["pay_cnt"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="buyin_gmv" prop="buyin_gmv">
        <template #default="scope">
          <div>
            {{ scope.row["buyin_gmv"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="remarks" prop="remarks">
        <template #default="scope">
          <div>
            {{ scope.row["remarks"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="tenant_type" prop="tenant_type">
        <template #default="scope">
          <div>
            {{ scope.row["tenant_type"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="tenant_id" prop="tenant_id">
        <template #default="scope">
          <div>
            {{ scope.row["tenant_id"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="del_state" prop="del_state">
        <template #default="scope">
          <div>
            {{ scope.row["del_state"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="add_user" prop="add_user">
        <template #default="scope">
          <div>
            {{ scope.row["add_user"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="add_user_id" prop="add_user_id">
        <template #default="scope">
          <div>
            {{ scope.row["add_user_id"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="add_time" prop="add_time">
        <template #default="scope">
          <div>
            {{ scope.row["add_time"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="edit_user" prop="edit_user">
        <template #default="scope">
          <div>
            {{ scope.row["edit_user"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="edit_user_id" prop="edit_user_id">
        <template #default="scope">
          <div>
            {{ scope.row["edit_user_id"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="last_edit_time" prop="last_edit_time">
        <template #default="scope">
          <div>
            {{ scope.row["last_edit_time"] }}
          </div>
        </template>
      </el-table-column>
      
      <el-table-column label="server_number" prop="server_number">
        <template #default="scope">
          <div>
            {{ scope.row["server_number"] }}
          </div>
        </template>
      </el-table-column>
      

      <el-table-column label="操作" fixed="right">
        <template #default="scope">
          <div>
            <el-button type="text" @click="() => triggerModify(scope.row)"
              >编辑</el-button
            >
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      :background="true"
      style="padding-top: 20px"
      background
      :page-size="queryParams.pageSize"
      layout="sizes,prev, pager, next"
      :total="total"
      @size-change="
        (pageSize) => {
          queryParams.pageSize = pageSize;
          dataList = [];
          getInfoList();
        }
      "
      @current-change="
        (pageNum) => {
          queryParams.pageNum = pageNum;
          dataList = [];
          getInfoList();
        }
      "
    ></el-pagination>
  </div>
</template>
<script setup>
import FormDialog from "../../components/FormDialog";

import axios from "axios";
import { ref, onMounted } from "vue";

const dataList = ref([]);
const total = ref(0);
const queryParams = ref({ pageNum: 1, pageSize: 10 });
const loading = ref(false);

async function getInfoList() {
  loading.value = true;
  var result = await axios
    .post("/api/live_anchor_live_list/apis", {
      _name: "getlist",
      module: "",
      ...queryParams.value,
    })
    .then((res) => res.data);
  total.value = result?.count || result?.total;
  dataList.value = result?.data || [];
  loading.value = false;
}

async function triggerModify(row) {
  var result = await FormDialog({
    title: "管理",
    data() {
      return { ...row };
    },
    components: {
      modify: () => import("./modify.vue"),
    },
  });
  console.log("result :", result);
  if (result?.success) {
    getInfoList();
  }
}

onMounted(() => {
  getInfoList();
});
</script>
